#ifndef EVIEW_H
#define EVIEW_H

#include <QGraphicsView>
#include <QGraphicsRectItem>

class EView : public QGraphicsView
{
    Q_OBJECT;
signals:
    void itemClicked(QGraphicsItem* item);
public:
    EView(QWidget* parent = NULL, const int w = 100, const int h = 100);
    //Set the current centerpoint in the
    void SetCenter(const QPointF& centerPoint);
protected:
    //Holds the current centerpoint for the view, used for panning and zooming
    QPointF CurrentCenterPoint;

    //From panning the view
    QPoint LastPanPoint;


    QPointF GetCenter() { return CurrentCenterPoint; }

    //Take over the interaction
    virtual void mousePressEvent(QMouseEvent* event);
    virtual void mouseReleaseEvent(QMouseEvent* event);
    virtual void mouseMoveEvent(QMouseEvent* event);
    virtual void wheelEvent(QWheelEvent* event);
    virtual void resizeEvent(QResizeEvent* event);
};

#endif // EVIEW_H
